package catchnthrow;

import se.lth.control.realtime.AnalogIn;
import se.lth.control.realtime.AnalogOut;



public class DummyMainThrow {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		/*
		 * Analog Input 1: angle
		 *  -10 \ (right down) ; +10 / (left down)
		 */
		AnalogIn analogInAngle = null;
		try {
			analogInAngle = new AnalogIn(1);
		} catch (Exception e2) {

			e2.printStackTrace();
		}
		
		/*
		 * Analog Input 2: ball position
		 *  - 10 left; +10 right
		 */
		AnalogIn analogInPosition = null;
		try {
			analogInPosition = new AnalogIn(2);
		} catch (Exception e1) {

			e1.printStackTrace();
		}
		
		/*
		 * Analog Output 0:
		 * Motor ca. -3; 3
		 * ALWAYS set to 0 after using!
		 */
		AnalogOut analogOut = null;
		try {
			analogOut = new AnalogOut(0);
		} catch (Exception e) {
			e.printStackTrace();
		}
	
			
		BallAndBeamRegul BB = new BallAndBeamRegul(analogInPosition, analogInAngle, analogOut, 8);
		
		Beam beam = new Beam(analogInAngle, analogOut, 7);
		
		Throw thr = new Throw(beam,BB,6);
		
		PIDParameters beamPar = new PIDParameters();
		beamPar.K = 4.5;
		beamPar.Ti = 7.0;
		beamPar.Tr = 10.0;
		beamPar.Td = 0.30;
		beamPar.N = 7.0;
		beamPar.Beta = 1.0;
		beamPar.H = 0.01;
		beamPar.integratorOn = true;
		
		beam.setParameters(beamPar);
		
		
		PIDParameters innerBallPar = new PIDParameters();
		innerBallPar.K = 4.5;
		innerBallPar.Ti = 7.0;
		innerBallPar.Tr = 10.0;
		innerBallPar.Td = 0.30;
		innerBallPar.N = 7.0;
		innerBallPar.Beta = 1.0;
		innerBallPar.H = 0.01;
		innerBallPar.integratorOn = true;

		BB.setInnerParameters(innerBallPar);

		PIDParameters outerBallPar = new PIDParameters();
		outerBallPar.K = -0.2;
		outerBallPar.Ti = 0.0;
		outerBallPar.Tr = 10.0;
		outerBallPar.Td = 0.9;
		outerBallPar.Beta = 1.0;
		outerBallPar.H = 0.01;
		outerBallPar.N = 10.0;
		outerBallPar.integratorOn = false;
		BB.setOuterParameters(outerBallPar);
		
		thr.setBallSize(thr.BigBall);
		
		thr.start();
		
		
	}

}
